package cn.stronglink.netrequest.business.patrol;

import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

import cn.stronglink.netrequest.util.HttpURL;
import cn.stronglink.netrequest.util.HttpUtil;
import okhttp3.Callback;


/**
 * Created by Tgb on 2018/6/15.
 * 巡检
 */

public class PatrolService {
    private Gson gson = new Gson();

    // 下载
    public void downloadPatrolWorkOrder(String userId, Callback callback) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        String params = gson.toJson(map);
        HttpUtil.httpPost(HttpURL.URL_PATROL_WORK_ORDER, params, callback);
    }

    // 上传
    public void uploadPatrolWorkOrder(String json, Callback callback) throws Exception {
        HttpUtil.httpPost(HttpURL.URL_UPLOAD_PATROL_WORK_ORDER, json, callback);
    }

    public String downloadPatrolWorkOrder(String userId) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        String params = gson.toJson(map);
        return HttpUtil.httpPostAsync(HttpURL.URL_PATROL_WORK_ORDER, params);
    }

    public String uploadPatrolWorkOrder(String json) throws Exception {
        return HttpUtil.httpPostAsync(HttpURL.URL_UPLOAD_PATROL_WORK_ORDER, json);
    }
}
